/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package FlyingType;

import Core.Status;
import Thing.Flying;

/**
 *
 * @author THINH
 */
public class Arrow extends Flying{
    //constructor
    public Arrow(){
        super();
    }
    
    public Arrow(int[]frameSequence){
        super("/resource/arrow.png",44,44, frameSequence);
        this.sprite.defineCollisionRectangle(0, 0, getWidth()*1/5, getHeight());
        attack = 7;
    }
    
    //main func
    public void update(){
        //code here
        if(status.value == Status.ShootHigh){
            if(vel.y<0){
                if(vel.y<power/2){
                    sprite.setFrame(6);
                }
                if(vel.y>=power/2){
                    sprite.setFrame(0);
                }
            }
            else if (vel.y == 0){
                sprite.setFrame(1);
            }
            else if (vel.y>0){
                if(power<0){
                    power*=-1;
                }
                if(vel.y<power/3){
                    sprite.setFrame(2);
                }
                else if(vel.y>=power/3 && vel.y<power/2){
                    sprite.setFrame(3);
                }
                else if(vel.y>=power/2 && vel.y<power){
                    sprite.setFrame(4);
                }
                else if(vel.y>= power){
                    sprite.setFrame(5);
                }
            }
        }
        super.update();
    }
}
